/**
 * <copyright>
 * </copyright>
 *

 */
package br.ufpe.cin.plp.eseml.impl;

import br.ufpe.cin.plp.eseml.AlternativeHypotheses;
import br.ufpe.cin.plp.eseml.EsemlPackage;
import br.ufpe.cin.plp.eseml.Hypotheses;
import br.ufpe.cin.plp.eseml.NullHypotheses;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Hypotheses</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link br.ufpe.cin.plp.eseml.impl.HypothesesImpl#getNullHypotheses <em>Null Hypotheses</em>}</li>
 *   <li>{@link br.ufpe.cin.plp.eseml.impl.HypothesesImpl#getAlternativesHypotheses <em>Alternatives Hypotheses</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class HypothesesImpl extends MinimalEObjectImpl.Container implements Hypotheses
{
  /**
   * The cached value of the '{@link #getNullHypotheses() <em>Null Hypotheses</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getNullHypotheses()
   * @generated
   * @ordered
   */
  protected NullHypotheses nullHypotheses;

  /**
   * The cached value of the '{@link #getAlternativesHypotheses() <em>Alternatives Hypotheses</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getAlternativesHypotheses()
   * @generated
   * @ordered
   */
  protected AlternativeHypotheses alternativesHypotheses;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected HypothesesImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return EsemlPackage.Literals.HYPOTHESES;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NullHypotheses getNullHypotheses()
  {
    return nullHypotheses;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetNullHypotheses(NullHypotheses newNullHypotheses, NotificationChain msgs)
  {
    NullHypotheses oldNullHypotheses = nullHypotheses;
    nullHypotheses = newNullHypotheses;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EsemlPackage.HYPOTHESES__NULL_HYPOTHESES, oldNullHypotheses, newNullHypotheses);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setNullHypotheses(NullHypotheses newNullHypotheses)
  {
    if (newNullHypotheses != nullHypotheses)
    {
      NotificationChain msgs = null;
      if (nullHypotheses != null)
        msgs = ((InternalEObject)nullHypotheses).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EsemlPackage.HYPOTHESES__NULL_HYPOTHESES, null, msgs);
      if (newNullHypotheses != null)
        msgs = ((InternalEObject)newNullHypotheses).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EsemlPackage.HYPOTHESES__NULL_HYPOTHESES, null, msgs);
      msgs = basicSetNullHypotheses(newNullHypotheses, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EsemlPackage.HYPOTHESES__NULL_HYPOTHESES, newNullHypotheses, newNullHypotheses));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public AlternativeHypotheses getAlternativesHypotheses()
  {
    return alternativesHypotheses;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetAlternativesHypotheses(AlternativeHypotheses newAlternativesHypotheses, NotificationChain msgs)
  {
    AlternativeHypotheses oldAlternativesHypotheses = alternativesHypotheses;
    alternativesHypotheses = newAlternativesHypotheses;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EsemlPackage.HYPOTHESES__ALTERNATIVES_HYPOTHESES, oldAlternativesHypotheses, newAlternativesHypotheses);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setAlternativesHypotheses(AlternativeHypotheses newAlternativesHypotheses)
  {
    if (newAlternativesHypotheses != alternativesHypotheses)
    {
      NotificationChain msgs = null;
      if (alternativesHypotheses != null)
        msgs = ((InternalEObject)alternativesHypotheses).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EsemlPackage.HYPOTHESES__ALTERNATIVES_HYPOTHESES, null, msgs);
      if (newAlternativesHypotheses != null)
        msgs = ((InternalEObject)newAlternativesHypotheses).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EsemlPackage.HYPOTHESES__ALTERNATIVES_HYPOTHESES, null, msgs);
      msgs = basicSetAlternativesHypotheses(newAlternativesHypotheses, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EsemlPackage.HYPOTHESES__ALTERNATIVES_HYPOTHESES, newAlternativesHypotheses, newAlternativesHypotheses));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case EsemlPackage.HYPOTHESES__NULL_HYPOTHESES:
        return basicSetNullHypotheses(null, msgs);
      case EsemlPackage.HYPOTHESES__ALTERNATIVES_HYPOTHESES:
        return basicSetAlternativesHypotheses(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case EsemlPackage.HYPOTHESES__NULL_HYPOTHESES:
        return getNullHypotheses();
      case EsemlPackage.HYPOTHESES__ALTERNATIVES_HYPOTHESES:
        return getAlternativesHypotheses();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case EsemlPackage.HYPOTHESES__NULL_HYPOTHESES:
        setNullHypotheses((NullHypotheses)newValue);
        return;
      case EsemlPackage.HYPOTHESES__ALTERNATIVES_HYPOTHESES:
        setAlternativesHypotheses((AlternativeHypotheses)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case EsemlPackage.HYPOTHESES__NULL_HYPOTHESES:
        setNullHypotheses((NullHypotheses)null);
        return;
      case EsemlPackage.HYPOTHESES__ALTERNATIVES_HYPOTHESES:
        setAlternativesHypotheses((AlternativeHypotheses)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case EsemlPackage.HYPOTHESES__NULL_HYPOTHESES:
        return nullHypotheses != null;
      case EsemlPackage.HYPOTHESES__ALTERNATIVES_HYPOTHESES:
        return alternativesHypotheses != null;
    }
    return super.eIsSet(featureID);
  }

} //HypothesesImpl
